#include <iostream>

using namespace std;
typedef unsigned long long NUM;

/*
Find the last ten digits of the series, 1^1 + 2^2 + 3^3 + ... + 1000^1000.
*/

int main()
{
	NUM result = 0;
	for (NUM i = 1; i <= 1000; i++)
	{
		NUM partial = i;
		for (NUM j = 1; j < i; j++)
		{
			partial *= i;
			partial %= 10000000000ull;
		}
		result += partial;
		result %= 10000000000ull;
	}

	cout << result << endl;
	return 0;
}
